package com.izocen.rules.common;

import java.io.Serializable;

public class ResponseMessage <T> implements Serializable{
	
	private static final long serialVersionUID = 1L;
	public static final int SUCC = 1;//成功
	public static final int FAIL = 0;//失败
	
	
	private int code;
	private String msg;
	private T data;
	

	public int getCode() {
		return code;
	}
	public void setCode(int code) {
		this.code = code;
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	
	public T getData() {
		return data;
	}
	public void setData(T data) {
		this.data = data;
	}
	
	public static <T>  ResponseMessage<T> succ(T data) {
		ResponseMessage<T> rm = new ResponseMessage<T>();
		rm.setCode(SUCC);
		rm.setMsg("succ..");
		rm.setData(data);
		return rm;
	}
	
	
	public static <T>  ResponseMessage<T> succ() {
		ResponseMessage<T> rm = new ResponseMessage<T>();
		rm.setCode(SUCC);
		return rm;
	}
	
	public static <T>  ResponseMessage<T> fail(String msg) {
		ResponseMessage<T> rm = new ResponseMessage<T>();
		rm.setCode(FAIL);
		rm.setMsg(msg);
		return rm;
	}

}
